
const app= getApp()
export default {
  props: {
    placeholder: {
      type: String,
      default: '说点什么吧...'
    },
    needLogin:{
      type:Boolean,
      default:false,
    }
  },
  data() {
    return {
      show: false,
      commentLevel: 0, // 评论层级 parent 一级 不传为 2 3 级
      keyboardHeight: 0, // 键盘高度
    }
  },
  watch: {
  },
  computed: {
    privacyData() {
      return this.$store.state.privacyData;
    },
  },
  mounted(){
  },
  methods: {
    // 评论输入点击事件
    handleEvaluate(show, commentLevel) {
      if(this.needLogin && !this.privacyData?.userId){
        this.$emit('needLoginFn')
        return false;
      }
      this.commentLevel = commentLevel;
      this.$refs.evaluateInputPop.togglePopup(show);
    },
    onEvaluateConfirm(e) {
      this.$emit('onConfirm', {...e, level: this.commentLevel})
    }
  }
}